import { useReducer } from 'react';
import { reducer, Context } from './reducer';
import Counter from './Counter';
import { Link } from 'umi';

function Father() {
  const [store, dispatch] = useReducer(reducer, window.defaultState); //创建reducer

  return (
    // 通过 state传递上下文 状态
    <Context.Provider value={{ store, dispatch }}>
      <Counter shop={'一'} />
      <Counter shop={'二'} />
      <hr />
      <Link to="./useReducer2/page1">page1</Link>
      <br />
      <Link to="./useReducer2/page2">page2</Link>
    </Context.Provider>
  );
}
export default Father;
